#include <QDBusConnection>
#include <QDBusInterface>

#include "gamma-manager-dbus.h"
#include "gamma-manager.h"
GmDbus::GmDbus(QObject* parent): QObject(parent)
{
    QDBusConnection::sessionBus().registerObject("0",this,QDBusConnection::ExportAllSlots);
}

GmDbus::~GmDbus()
{

}

int GmDbus::setScreenBrightness(QString screenName, int screenBrightness)
{
    Q_EMIT screenBrightnessSetSignal(screenName, screenBrightness);
    return 0;
}

OutputGammaInfo GmDbus::getScreensGamma()
{
    GammaManager *pGmManager =  static_cast<GammaManager*> (this->parent());
    return pGmManager->getScreensInfo();
}

OutputGammaInfoList GmDbus::getScreensGammaList(QString appName)
{
    GammaManager *pGmManager =  static_cast<GammaManager*> (this->parent());
    return pGmManager->getScreensInfoList();
}


QHash<QString, QVariant> GmDbus::getScreensGammaInfo()
{
    return QHash<QString, QVariant> {

           { QStringLiteral("ActiveEnabled"), true},


           { QStringLiteral("ModeEnabled"), true}
    };
}

int GmDbus::setColorTemperature(QString appName, int colorTemp)
{
    GammaManager *pGmManager =  static_cast<GammaManager*> (this->parent());
    return pGmManager->setTemperature(colorTemp);
}
